import 'dart:convert';
import 'package:ichinesereader/exam/dto/assessment.response.dart';

AssessmentQuestionsResult assessmentQuestionsResultFromJson(String str) =>
    AssessmentQuestionsResult.fromJson(json.decode(str));
String assessmentQuestionsResultToJson(AssessmentQuestionsResult data) =>
    json.encode(data.toJson());

class AssessmentQuestionsResult {
  AssessmentQuestionsResult({
    this.status,
    this.message,
    this.result,
  });

  int? status;
  String? message;
  AssessmentQuestions? result;

  factory AssessmentQuestionsResult.fromJson(Map<String, dynamic> json) =>
      AssessmentQuestionsResult(
        status: json["status"],
        message: json["message"],
        result: json["result"] != null
            ? AssessmentQuestions.fromJson(json["result"])
            : null,
      );

  Map<String, dynamic> toJson() => {
        "status": status,
        "message": message,
        "result": result?.toJson(),
      };
}

class AssessmentQuestions {
  AssessmentQuestions({
    this.mandarin,
    this.recordStatus,
    this.simplified,
    this.commitTime,
    this.list,
    this.questionGroupId,
    this.bookId,
  });

  bool? mandarin;
  String? recordStatus;
  bool? simplified;
  int? commitTime;
  List<QuestionItem>? list;
  String? questionGroupId;
  String? bookId;

  factory AssessmentQuestions.fromJson(Map<String, dynamic> json) =>
      AssessmentQuestions(
        mandarin: json["mandarin"],
        recordStatus: json["recordStatus"],
        simplified: json["simplified"],
        commitTime: json["commitTime"],
        list: json["list"] != null
            ? List<QuestionItem>.from(
                json["list"].map((x) => QuestionItem.fromJson(x)))
            : null,
        questionGroupId: json["questionGroupId"],
        bookId: json["bookId"],
      );

  Map<String, dynamic> toJson() => {
        "mandarin": mandarin,
        "recordStatus": recordStatus,
        "simplified": simplified,
        "commitTime": commitTime,
        "list": list != null
            ? List<dynamic>.from(list!.map((x) => x.toJson()))
            : null,
        "questionGroupId": questionGroupId,
        "bookId": bookId,
      };
}
